package simple

type MyStack255 struct {
	data []int
}

func Constructor() MyStack255 {
	return MyStack255{
		data: make([]int, 0),
	}
}

func (this *MyStack255) Push(x int) {
	this.data = append(this.data, x)
}

func (this *MyStack255) Pop() int {
	if len(this.data) == 0 {
		return 0
	}

	last := this.data[len(this.data)-1]
	this.data = this.data[:len(this.data)-1]
	return last
}

func (this *MyStack255) Top() int {
	return this.data[len(this.data)-1]
}

func (this *MyStack255) Empty() bool {
	return len(this.data) == 0
}
